package com.rongshu.view.discovery.presenter;

import android.content.Context;

import com.rongshu.api.RetorfitService;
import com.rongshu.utils.Common;
import com.rongshu.view.base.mvp.BasePresenter;
import com.rongshu.view.base.mvp.INetView;
import com.rongshu.view.discovery.bean.TaArticleResponse;
import com.rongshu.view.penpal.bean.PenpalArticleResponse;
import com.rongshu.view.userInfo.entity.Invitation;

import java.util.HashMap;
import java.util.Map;

import rx.Subscriber;
import rx.functions.Action0;

/**
 * created by zhengweis on 2018/12/18.
 * description：
 */
public class UserPostPresenter extends BasePresenter<INetView> {

    public UserPostPresenter(Context context) {
        super(context);
    }

    public void getPostList(int userId, int pageIndex, int pageSize) {
        Map<String, Object> map = new HashMap<>();
        map.put("user_id", userId);
        map.put("page", pageIndex);
        map.put("pagesize", pageSize);
        RetorfitService.getMyForum(userId, pageIndex, pageSize,
                Common.encryptionSign(map)).doOnSubscribe(new Action0() {
            @Override
            public void call() {

            }
        }).subscribe(new Subscriber<PenpalArticleResponse>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(PenpalArticleResponse object) {
                getView().success(object, 0);
            }
        });
    }
}
